import request from '@/sheep/request';

const FollowApi = {
  // 关注用户
  createFollow: (followUserId) => {
    return request({
      url: '/app/follow/create',
      method: 'POST',
      params: {
        followUserId: followUserId
      },
      custom: {
        auth: true,
        showLoading: true,
        loadingMsg: '关注中',
        showSuccess: true,
        successMsg: '关注成功',
      },
    });
  },
  // 取消关注用户
  deleteFollow: (followUserId) => {
    return request({
      url: '/app/follow/delete',
      method: 'DELETE',
      params: {
        followUserId: followUserId
      },
      custom: {
        auth: true,
        showLoading: true,
        loadingMsg: '取消关注中',
        showSuccess: true,
        successMsg: '取消关注成功',
      },
    });
  },
  // 检查是否已关注
  checkFollow: (targetUserId) => {
    return request({
      url: '/app/follow/check',
      method: 'GET',
      params: {
        targetUserId: targetUserId
      },
      custom: {
        auth: true,
        showLoading: false,
        showError: false, // 不显示错误，避免未登录时显示错误提示
      },
    });
  },
  // 获取我关注的用户列表
  getFollowList: () => {
    return request({
      url: '/app/follow/follow-list',
      method: 'GET',
      custom: {
        auth: true,
        showLoading: true,
        loadingMsg: '加载中',
      },
    });
  },
  // 获取我的粉丝列表
  getFansList: () => {
    return request({
      url: '/app/follow/fans-list',
      method: 'GET',
      custom: {
        auth: true,
        showLoading: true,
        loadingMsg: '加载中',
      },
    });
  },
};

export default FollowApi;

